

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layuiAdmin 网站用户 iframe 框</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/admin/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/admin/layuiadmin/style/admin.css" media="all">
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
    <input type="hidden" name="uids" id="uids" value="" />
    <div class="layui-form layuiadmin-card-header-auto">
        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label">用户ID</label>
                <div class="layui-input-block">
                    <input type="text" name="id" placeholder="请输入" value="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">用户昵称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">联系人姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="namex" placeholder="请输入联系人姓名" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <label class="layui-form-label">联系人手机号</label>
                <div class="layui-input-block">
                    <input type="text" name="phone" placeholder="请输入联系人手机号" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-inline">
                <button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                </button>
            </div>
        </div>
    </div>

    <table class="layui-table" lay-data="{ url:'/admin/User/userlist',method:'post', page:true, id:'LAY-user-managet'}" lay-filter="LAY-user-managet">
        <thead>
        <tr>
            <th lay-data="{type: 'radio', fixed: 'left'}"></th>
            <th lay-data="{field:'id', width:120, sort: true}">ID</th>
            <th lay-data="{field:'nick'}">昵称</th>
            <th lay-data="{field:'headimg',templet:'#img'}">头像</th>
            <th lay-data="{field:'status',templet:'#status'}">状态</th>
        </tr>
        </thead>
    </table>

    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
    </div>
</div>

<script type="text/html" id="img">
    <img src="{{d.headimg}}" style="height:25px;">
</script>
<script type="text/html" id="status">
    {{# if(d.status==1){ }}
    正常
    {{# }else if(d.status==2){ }}
    封号
    {{# }else{ }}
    其他
    {{# } }}
</script>

<script src="/admin/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/admin/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload','element','laydate','tree','table'], function(){
        var $ = layui.$
            ,form = layui.form
            ,upload = layui.upload
            ,tree = layui.tree
            ,table = layui.table
            ,laydate = layui.laydate;

        //搜索角色
        form.on('submit(LAY-user-front-search)', function(data){
            var field = data.field;
            $.post("{:url('admin/User/userlist')}", field, function(data,state){ });
            //执行重载
            table.reload('LAY-user-managet', {
                where: field
            });
        });

        table.on('radio(LAY-user-managet)', function(obj){ //test 是 table 标签对应的 lay-filter 属性
            console.log(obj); //当前行的一些常用操作集合
            console.log(obj.checked); //当前是否选中状态
            console.log(obj.data); //选中行的相关数据
            var id=obj.data.id;
            $("#uids").val(id);
        });


    })


</script>
</body>
</html>